home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d18
/
probots.arc
/
DECOY.PR
< prev
next >
Wrap
Text File
|
1991-04-28
|
788b
|
29 lines
PROCEDURE DECOY;
{ Based on a C-Robot By Bruce Oberleitner }
{ Decoy runs around the field, randomly }
{ and randomly fires. Decoy makes an excellent}
{ practice target to test new robots. }
PROCEDURE go(dest_x, dest_y : Integer);
{ go - go to the point specified }
VAR course : Integer;
BEGIN
course := Angle_To(dest_x, dest_y);
drive(course, 100);
WHILE (distance(loc_x, loc_y, dest_x, dest_y) > 100)
DO cannon(Random(360), Random(700)); {fire randomly}
drive(course, 0);
WHILE (speed > 0) DO {nothing} ;
END;
BEGIN {Decoy Main}
REPEAT
go(1+Random(995), 1+Random(995)); { go somewhere in the field }
UNTIL Dead OR Winner;
END; { end of Decoy Main }